<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
    String path = request.getContextPath();
    if (path.length() > 0) path = path.substring(0, path.length() - 1);
%>
<jsp:include flush="true" page="/view/inc/incTop.jsp"/>
<!-- head-->
<script language="javascript">
    function buy1() {
        <s:if test="#session.user==null">
        alert("请先登录");
        </s:if>
        <s:else>
        document.buy.submit();
        </s:else>
    }
</script>
<!--body-->
<div class="container">
    <div class="row">
        <div class="col-xs-6">
            <h1><s:property value="#request.good.goodName"/></h1>
        </div>
        <div class="col-xs-6">
            <p class="text-right"><a href="">帮助 <span class="glyphicon glyphicon-download-alt"
                                                      aria-hidden="true"></span></a></p>
        </div>
    </div>
    <hr>
    <div class="row">
        <div class="col-xs-7">
            <div class="media">
                <div class="media-left"><a href="#"> <img src="<%=path %><s:property value="#request.good.goodPic"/>"
                                                          width="260"/></a></div>
                <div class="media-body">
                    <h2 class="media-heading">详情</h2>
                    <s:property value="#request.good.goodInfo" escapeHtml="false"/></div>
            </div>
        </div>
        <div class="col-xs-5">
            <div class="row well" style="border: 0;">
                <div class="row">
                    <div class="col-lg-12">
                        <h4><span class="glyphicon glyphicon-phone" aria-hidden="true"></span> 库存：
                            <s:property value="#request.good.goodInventory"/></h4>
                    </div>
                </div>
                <div class="row">
                    <div class="col-lg-12">
                        <h4><span class="glyphicon glyphicon-map-marker" aria-hidden="true"></span> 价格：
                            <s:property value="#request.good.goodPrice"/>元</h4>
                    </div>
                </div>
            </div>
            <div class="row">
                <form action="<%=path %>/order/addToCart.action" method="post" name="buy">
                    <div class="well col-lg-offset-0 col-lg-12" style="background:#DCF4FF;border: 0;">
                        <h4 style="text-align:right">购买 <input type="text" class="form-control" name="goodCount"
                                                               value="1" size="8"
                                                               onkeyup="this.value=this.value.replace(/\D/g,'')"
                                                               onafterpaste="this.value=this.value.replace(/\D/g,'')"
                                                               style="display: inline; text-align: right; width: 50pt"/> 个
                        </h4>
                        <input type="hidden" name="goodId" value="<s:property value="#request.good.goodId"/>">
                        <div class="btn-danger btn-xs" style="cursor: pointer;">
                            <h4 style="text-align:center" onclick="buy1()">立即购买</h4></div>
                    </div>
                </form>
            </div>
        </div>

    </div>
    <div class="row">
        <div class="col-lg-6 col-lg-offset-6"></div>
    </div>
</div>
<hr>
<!--body-->


<!--foot -->
<jsp:include flush="true" page="/view/inc/incFoot.jsp"/>
<!--foot -->	

